package cumt.kydd.authoringplatform.controller;

import cumt.kydd.authoringplatform.bean.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cumt.kydd.authoringplatform.service.UserService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("user")
public class UserLoginController
{
    @Resource
    private UserService userService;

    /*
     *注册账号
     */
    @PostMapping("create")
    public Map<String, Object> createAccount(User user,String password_again)
    {
        return userService.createAccount(user);
    }

    /*
     *登陆账号
     */
    @PostMapping("login")
    public Map<String, Object> loginAccount(User user, HttpServletRequest request)
    {
        return userService.loginAccount(user,request);
    }
}
